@use '@angular/material' as mat;

:host {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.generated-image-container {
  max-width: 400px;
}

.generated-image {
  max-width: 100%;
  min-width: 40px;
  border-radius: 8px;
}

.html-artifact-container {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.loading-bar {
  width: 100px;
  margin: 15px;
}

.chat-messages {
  flex-grow: 1;
  overflow-y: auto;
  padding: 20px;
  margin-top: 16px;
}

.message-card {
  padding: 5px 20px;
  margin: 5px;
  border-radius: 20px;
  max-width: 80%;
  font-size: 14px;
  font-weight: 400;
  position: relative;
  display: inline-block;
  &.message-card--highlighted {
    background-color: var(
      --chat-panel-function-event-button-highlight-background-color
    );
  }
}

.function-event-button {
  background-color: var(--chat-panel-function-event-button-background-color);
  margin: 5px 5px 10px;
}

.function-event-button-highlight {
  background-color: var(
    --chat-panel-function-event-button-highlight-background-color
  );
  border-color: var(
    --chat-panel-function-event-button-highlight-border-color
  ) !important;
  color: var(--chat-panel-function-event-button-highlight-color) !important;
}

// Enables messages to have columns
.message-column-container {
  display: flex;
  flex-direction: column;
}

.user-message {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  .message-card {
    background-color: var(
      --chat-panel-user-message-message-card-background-color
    );
    align-self: flex-end;
    color: var(--chat-panel-user-message-message-card-color);
    box-shadow: none;
  }
}

.bot-message {
  display: flex;
  align-items: center;
  .message-card {
    background-color: var(
      --chat-panel-bot-message-message-card-background-color
    );
    align-self: flex-start;
    color: var(--chat-panel-bot-message-message-card-color);
    box-shadow: none;
  }
}

.bot-message:focus-within {
  .message-card {
    background-color: var(
      --chat-panel-bot-message-focus-within-message-card-background-color
    );
    border: 1px solid
      var(--chat-panel-bot-message-focus-within-message-card-border-color);
  }
}

.message-textarea {
  background-color: var(--chat-panel-message-textarea-background-color);
  max-width: 100%;
  border: none;
  font-family: 'Google Sans', 'Helvetica Neue', sans-serif;
}

.message-textarea:focus {
  background-color: var(--chat-panel-message-textarea-focus-background-color);
  outline: none;
}

.edit-message-buttons-container {
  display: flex;
  justify-content: flex-end;
}

.message-card .eval-compare-container {
  visibility: hidden;
  position: absolute;
  left: 10px;
  z-index: 10;
  background-color: var(--chat-panel-eval-compare-container-background-color);
  overflow: hidden;
  border-radius: 20px;
  padding: 5px 20px;
  margin-bottom: 10px;
  font-size: 16px;

  .actual-result {
    border-right: 2px solid var(--chat-panel-actual-result-border-right-color);
    padding-right: 8px;
    min-width: 350px;
    max-width: 350px;
  }

  .expected-result {
    padding-left: 12px;
    min-width: 350px;
    max-width: 350px;
  }
}

.message-card:hover .eval-compare-container {
  visibility: visible;
}

.actual-expected-compare-container {
  display: flex;
}

.score-threshold-container {
  display: flex;
  justify-content: center;
  gap: 10px;
  align-items: center;
  margin-top: 15px;
  font-size: 14px;
  font-weight: 600;
}

.eval-response-header {
  padding-bottom: 5px;
  border-bottom: 2px solid
    var(--chat-panel-eval-response-header-border-bottom-color);
  font-style: italic;
  font-weight: 700;
}

.header-expected {
  color: var(--chat-panel-header-expected-color);
}

.header-actual {
  color: var(--chat-panel-header-actual-color);
}

.eval-case-edit-button {
  cursor: pointer;
  margin-left: 4px;
  margin-right: 4px;
}

.eval-pass {
  display: flex;
  color: var(--chat-panel-eval-pass-color);
}

.eval-fail {
  display: flex;
  color: var(--chat-panel-eval-fail-color);
}

.hidden {
  visibility: hidden;
}

.chat-input {
  display: flex;
  padding: 10px;
  width: 60%;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.input-field {
  flex-grow: 1;
  position: relative;
  z-index: 1;

  textarea {
    color: var(--chat-panel-input-field-textarea-color);
    border: none;
    padding: 10px;
    box-sizing: content-box;
    caret-color: var(--chat-panel-input-field-textarea-caret-color);

    &::placeholder {
      color: var(--chat-panel-input-field-textarea-placeholder-color);
    }
  }

  button {
    color: var(--chat-panel-input-field-button-color);
    background-color: var(--chat-panel-input-field-button-background-color);
  }
}

.chat-input-actions {
  width: 106%;
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 100%;

  button {
    margin-left: 10px;
    margin-right: 10px;
  }
}

.file-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
  margin-bottom: 8px;
}

.image-preview {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
}

.image-preview-chat {
  max-width: 90%;
  max-height: 70vh;
  width: auto;
  height: auto;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s ease-in-out;
}

.attachment {
  display: flex;
  align-items: center;
}

:host ::ng-deep .mat-mdc-mini-fab {
  background-color: var(--chat-panel-mat-mdc-mini-fab-background-color);
  mat-icon {
    color: var(--chat-panel-mat-mdc-mini-fab-mat-icon-color);
  }
}

:host ::ng-deep .message-text {
  p {
    white-space: pre-line;
    word-break: break-word;
    overflow-wrap: break-word;
  }
}

:host ::ng-deep .input-field .mat-mdc-text-field-wrapper {
  border: 1px solid
    var(--chat-panel-input-field-mat-mdc-text-field-wrapper-border-color);
  border-radius: 16px;
}

.image-container {
  position: relative;
  display: inline-block;
  border-radius: 12px;
  overflow: hidden;
}

.image-preview {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  width: 80px;
  height: 80px;
}

.delete-button {
  position: absolute;
  top: 1px;
  right: 1px;
  background-color: var(--chat-panel-delete-button-background-color);
  border: none;
  border-radius: 50%;
  padding: 8px;
  cursor: pointer;
  color: var(--chat-panel-delete-button-color);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 0px;
  scale: 0.7;
}

.delete-button mat-icon {
  font-size: 20px;
}

.file-container {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 80px;
  background-color: var(--chat-panel-file-container-background-color);
  border-radius: 12px;
}

.file-info {
  margin-right: 60px;
  padding-top: 20px;
  padding-left: 16px;
}

.thought-chip {
  border-radius: 5px;
  background-color: var(--chat-panel-thought-chip-background-color);
  width: 80px;
  text-align: center;
  margin-top: 5px;
}

:host ::ng-deep pre {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  max-width: 100%;
}

.link-style-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--chat-panel-link-style-button-color) !important;
  text-decoration: underline;
  cursor: pointer;
  outline: none;
  font-size: 14px;
}

.cancel-edit-button {
  width: 24px;
  height: 24px;
  color: var(--chat-mat-mdc-text-field-wrapper-border-color);
  cursor: pointer;
  margin-right: 16px;
}

.save-edit-button {
  width: 24px;
  height: 24px;
  color: var(--mat-sys-primary);
  cursor: pointer;
  margin-right: 16px;
}

.chat-input-box {
  caret-color: white;
}

button.audio-rec-btn,
button.video-rec-btn {
  background-color: var(--chat-card-background-color);
  &.recording {
    background-color: var(--chat-panel-eval-fail-color);
  }
}

.loading-spinner-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
}

.feedback-buttons {
  // Default touch target is fixed at 48px, which is too large
  --mat-icon-button-touch-target-display: none;
  margin-left: 50px;

  button {
    padding: 0;
    height: 24px;
    width: 24px;
    min-height: 24px;
    min-width: 24px;
  }
  mat-icon {
    font-size: 12px;
    height: 12px;
    width: 12px;
  }
}
